<template>
  <div class="app-container">
    <Editor v-model="form.configValue" />
    <div style="text-align:center;margin:20px;">
      <el-button type="primary" @click="onSave">保存</el-button>
    </div>
  </div>
</template>

<script>
import { getConfig, updateConfig } from "@/api/system/config";
import Editor from "@/components/tinymce-editor/index.vue";
export default {
  name: "Policy",
  components: {
    Editor
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        type: [{ required: true, message: "请输入类型", trigger: "blur" }]
      }
    };
  },
  created() {
    getConfig(100).then(res => {
      this.form = res.data;
    });
  },
  methods: {
    /** 提交按钮 */
    onSave() {
      updateConfig(this.form).then(response => {
        this.msgSuccess("修改成功");
      });
    }
  }
};
</script>
